﻿namespace TelecoSystems.Web.Models
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data.Objects.DataClasses;
    using System.Linq;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;
    using System.Runtime.Serialization;

    // The MetadataTypeAttribute identifies CustomerMetadata as the class
    // that carries additional metadata for the Customer class.
    [MetadataTypeAttribute(typeof(Customer.CustomerMetadata))]
    public partial class Customer
    {
        // This class allows you to attach custom attributes to properties
        // of the Customer class.
        //
        // For example, the following marks the Xyz property as a
        // required property and specifies the format for valid values:
        //    [Required]
        //    [RegularExpression("[A-Z][A-Za-z0-9]*")]
        //    [StringLength(32)]
        //    public string Xyz { get; set; }
        internal sealed class CustomerMetadata
        {

            // Metadata classes are not meant to be instantiated.
            private CustomerMetadata()
            {
            }

            [Editable(false)]
            public int Id { get; set; }

            [Editable(false)]
            [Display(Name = "Created", Description = "Date when the record was created.")]
            public DateTime DateCreated { get; set; }

            [Editable(false)]
            [Display(Name = "Modified", Description = "Date of the last modification.")]
            public DateTime DateLastModified { get; set; }

            [Required]
            [RegularExpression("")]//todo: add regular expression for email
            public string Email { get; set; }

            [Required]
            [StringLength(40)]
            [Display(Description = "Full name of the customer.")]  
            public string Name { get; set; }

            [StringLength(250)]
            public string Note { get; set; }

            public string Phone { get; set; }
            
            public string AddressStreet { get; set; }
            
            public string AddressCity { get; set; }

            public string AddressPostalCode { get; set; }

            public string AddressCountry { get; set; }

            public EntityCollection<Contract> Contracts { get; set; }
        }
    }
}
